<template>
  <div class="container">
    <div class="flex_row">
      <div class="row">
        <div class="font">
          <span style="color: red">*</span>课程名称：
        </div>
        <div>
          <el-input
            v-model="courseName"
            placeholder="请输入课程名称"
            clearable
            size="small"
          />
        </div>
      </div>
      <div class="row">
        <div class="font">
          <span style="color: red">*</span>课程标识：
        </div>
        <div>
          <el-select v-model="courseFlag" placeholder="课程标识" class="search_info">
            <el-option
              v-for="item in status"
              :key="item.key"
              :label="item.value"
              :value="item.key"
            ></el-option>
          </el-select>
        </div>
      </div>
    </div>
    <div class="footer">
      <el-button @click="back()">返回</el-button>
      <el-button type="primary" @click="submit()">提交</el-button>
    </div>
  </div>
</template>

<script>
import { courseAdd } from "@/api/system/user";
export default {
  components: {
   
  },
  data() {
    return {
      courseName: '',
      courseFlag: '',
      status: [
        {key: '1', value: '移动端展示'},
        {key: '2', value: '移动端不展示'}
      ]
    }
  },
  created() {
  },
  mounted(){
   
  },
  methods: {
    back() {
      this.$router.push('courseList')
    },
    submit() {
      let params = {
        courseName: this.courseName,
        courseFlag: this.courseFlag
      }
      courseAdd(params).then(res => {
        if (res.code == 200) {
          this.$message({ message: res.msg, type: "success" });
          this.$router.push('courseList')
        } else {
          this.$message({ message: res.msg, type: "error" });
        }
      });
    }
  }
}
</script>
<style scoped>
  .container {
    padding-left: 26px;
    padding-right: 24px;
    padding-top: 24px;
  }
  .row {
    display:flex;
    padding-bottom: 20px;
  }
  .line {
    height: 1px;
    background: #DCDFE6;
    width: 100%;
    margin-top: 6px;
    margin-bottom: 20px;
  }
  .row .font {
    width: 200px;
    text-align: right;
    margin-right: 20px;
  }
  .row .fonts {
    width: 300px;
    text-align: right;
    margin-right: 20px;
  }
  .flex_row {
    /* display: flex; */
  }
  .footer {
    width: 340px;
    text-align: right;
    margin-top: 40px
  }
</style>
